s/format/type/g to be consistent with gdk_pixbuf_loader_new_with_type().
authorHavoc Pennington <hp@redhat.com>
Fri, 6 Oct 2000 18:26:23 +0000 (18:26 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Fri, 6 Oct 2000 18:26:23 +0000 (18:26 +0000)
2000-10-06  Havoc Pennington  <hp@redhat.com>

* gdk-pixbuf-io.c (gdk_pixbuf_save): s/format/type/g to be
consistent with gdk_pixbuf_loader_new_with_type().
Return runtime error if a module is missing.

* gdk-pixbuf.h: add GDK_PIXBUF_ERROR_UNKNOWN_TYPE

gdk-pixbuf/ChangeLog
gdk-pixbuf/gdk-pixbuf-io.c
gdk-pixbuf/gdk-pixbuf.h

index a60d5b6f099908dd04869f425f391608f5beb55b..1a90308bc9db20b6c11ad93db9d03df42a9a9f67 100644 (file)
@@ -1,3 +1,11 @@
+2000-10-06  Havoc Pennington  <hp@redhat.com>
+
+       * gdk-pixbuf-io.c (gdk_pixbuf_save): s/format/type/g to be
+       consistent with gdk_pixbuf_loader_new_with_type(). 
+       Return runtime error if a module is missing.
+
+       * gdk-pixbuf.h: add GDK_PIXBUF_ERROR_UNKNOWN_TYPE
+
 2000-10-05  Havoc Pennington  <hp@redhat.com>
 
         Pixbuf saving, patch from David Welton.
index 0e3ca13f531a797fa0daacf85412a59ce99dd0db..d861c561126ba63fd151ac9989300bf1c4e7291c 100644 (file)
@@ -645,7 +645,7 @@ collect_save_options (va_list   opts,
 static gboolean
 gdk_pixbuf_real_save (GdkPixbuf     *pixbuf, 
                       FILE          *filehandle, 
-                      const char    *format
+                      const char    *type
                       gchar        **keys,
                       gchar        **values,
                       GError       **error)
@@ -654,14 +654,17 @@ gdk_pixbuf_real_save (GdkPixbuf     *pixbuf,
        GdkPixbufModule *image_module = NULL;       
        
        for (i = 0; file_formats[i].module_name; i++) {
-               if (!strcmp (file_formats[i].module_name, format)) {
+               if (!strcmp (file_formats[i].module_name, type)) {
                        image_module = &(file_formats[i]);
                        break;
                }
        }
        
        if (!image_module) {
-               g_warning ("gdk-pixbuf does not support the format: %s", format);
+               g_set_error (error,
+                            GDK_PIXBUF_ERROR,
+                            GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
+                            _("This build of gdk-pixbuf does not support saving the image format: %s"), type);
                return FALSE;
        }
        
@@ -682,11 +685,11 @@ gdk_pixbuf_real_save (GdkPixbuf     *pixbuf,
  * gdk_pixbuf_save:
  * @pixbuf: pointer to GdkPixbuf.
  * @filename: Name of file to save.
- * @format: name of file format.
+ * @type: name of file format.
  * @error: return location for error, or NULL
  * @Varargs: list of key-value save options
  *
- * Saves pixbuf to a file in @format, which is currently "jpeg" or
+ * Saves pixbuf to a file in @type, which is currently "jpeg" or
  * "png".  If @error is set, FALSE will be returned. Possible errors include those
  * from #GdkPixbufErrorType and those from #GFileErrorType.
  *
@@ -708,7 +711,7 @@ gdk_pixbuf_real_save (GdkPixbuf     *pixbuf,
 gboolean
 gdk_pixbuf_save (GdkPixbuf  *pixbuf, 
                  const char *filename, 
-                 const char *format
+                 const char *type
                  GError    **error,
                  ...)
 {
@@ -723,7 +726,7 @@ gdk_pixbuf_save (GdkPixbuf  *pixbuf,
         
         va_end (args);
 
-        result = gdk_pixbuf_savev (pixbuf, filename, format,
+        result = gdk_pixbuf_savev (pixbuf, filename, type,
                                    keys, values,
                                    error);
 
@@ -737,12 +740,12 @@ gdk_pixbuf_save (GdkPixbuf  *pixbuf,
  * gdk_pixbuf_savev:
  * @pixbuf: pointer to GdkPixbuf.
  * @filename: Name of file to save.
- * @format: name of file format.
+ * @type: name of file format.
  * @option_keys: name of options to set, NULL-terminated
  * @option_values: values for named options
  * @error: return location for error, or NULL
  *
- * Saves pixbuf to a file in @format, which is currently "jpeg" or "png".
+ * Saves pixbuf to a file in @type, which is currently "jpeg" or "png".
  * If @error is set, FALSE will be returned. See gdk_pixbuf_save () for more
  * details. Possible errors include those from #GdkPixbufErrorType and
  * those from #GFileErrorType.
@@ -753,7 +756,7 @@ gdk_pixbuf_save (GdkPixbuf  *pixbuf,
 gboolean
 gdk_pixbuf_savev (GdkPixbuf  *pixbuf, 
                   const char *filename, 
-                  const char *format,
+                  const char *type,
                   char      **option_keys,
                   char      **option_values,
                   GError    **error)
@@ -763,7 +766,7 @@ gdk_pixbuf_savev (GdkPixbuf  *pixbuf,
         
        
         g_return_val_if_fail (filename != NULL, FALSE);
-        g_return_val_if_fail (format != NULL, FALSE);
+        g_return_val_if_fail (type != NULL, FALSE);
        
         f = fopen (filename, "w");
         
@@ -777,7 +780,7 @@ gdk_pixbuf_savev (GdkPixbuf  *pixbuf,
         }
 
        
-       result = gdk_pixbuf_real_save (pixbuf, f, format,
+       result = gdk_pixbuf_real_save (pixbuf, f, type,
                                       option_keys, option_values,
                                       error);
        
index b7c0a6b88680edb58f94fd1c70d9bf2683775730..82f0551bac90207758639a85ea05ed6b592d1813 100644 (file)
@@ -68,6 +68,8 @@ typedef enum {
         GDK_PIXBUF_ERROR_IO,
         /* bad option value passed to save routine */
         GDK_PIXBUF_ERROR_BAD_OPTION_VALUE,
+        /* unsupported image type (sort of an ENOSYS) */
+        GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
         GDK_PIXBUF_ERROR_FAILED
 } GdkPixbufErrorType;